Optimal. Leaf size=177 \[ \frac {\log \left (a+b x+c x^2\right ) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )}{2 c^3}-\frac {\tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-c^2 (2 a d h+2 a e g+b d g+b e f)+b c (3 a e h+b d h+b e g)+b^3 (-e) h+2 c^3 d f\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {x (-b e h+c d h+c e g)}{c^2}+\frac {e h x^2}{2 c} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.35, antiderivative size = 177, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {1628, 634, 618, 206, 628} \[ \frac {\log \left (a+b x+c x^2\right ) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )}{2 c^3}-\frac {\tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (-c^2 (2 a d h+2 a e g+b d g+b e f)+b c (3 a e h+b d h+b e g)+b^3 (-e) h+2 c^3 d f\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {x (-b e h+c d h+c e g)}{c^2}+\frac {e h x^2}{2 c} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 618
Rule 628
Rule 634
Rule 1628
Rubi steps
\begin {align*} \int \frac {(d+e x) \left (f+g x+h x^2\right )}{a+b x+c x^2} \, dx &=\int \left (\frac {c e g+c d h-b e h}{c^2}+\frac {e h x}{c}+\frac {c^2 d f+a b e h-a c (e g+d h)+\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) x}{c^2 \left (a+b x+c x^2\right )}\right ) \, dx\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\int \frac {c^2 d f+a b e h-a c (e g+d h)+\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) x}{a+b x+c x^2} \, dx}{c^2}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^3}+\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^3}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \log \left (a+b x+c x^2\right )}{2 c^3}-\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \operatorname {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^3}\\ &=\frac {(c e g+c d h-b e h) x}{c^2}+\frac {e h x^2}{2 c}-\frac {\left (2 c^3 d f-b^3 e h-c^2 (b e f+b d g+2 a e g+2 a d h)+b c (b e g+b d h+3 a e h)\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^3 \sqrt {b^2-4 a c}}+\frac {\left (c^2 (e f+d g)+b^2 e h-c (b e g+b d h+a e h)\right ) \log \left (a+b x+c x^2\right )}{2 c^3}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.20, size = 173, normalized size = 0.98 \[ \frac {\log (a+x (b+c x)) \left (-c (a e h+b d h+b e g)+b^2 e h+c^2 (d g+e f)\right )-\frac {2 \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {4 a c-b^2}}\right ) \left (c^2 (2 a d h+2 a e g+b d g+b e f)-b c (3 a e h+b d h+b e g)+b^3 e h-2 c^3 d f\right )}{\sqrt {4 a c-b^2}}+2 c x (-b e h+c d h+c e g)+c^2 e h x^2}{2 c^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.93, size = 654, normalized size = 3.69 \[ \left [\frac {{\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e h x^{2} + \sqrt {b^{2} - 4 \, a c} {\left ({\left (2 \, c^{3} d - b c^{2} e\right )} f - {\left (b c^{2} d - {\left (b^{2} c - 2 \, a c^{2}\right )} e\right )} g + {\left ({\left (b^{2} c - 2 \, a c^{2}\right )} d - {\left (b^{3} - 3 \, a b c\right )} e\right )} h\right )} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c - \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) + 2 \, {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e g + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} h\right )} x + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e f + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} g - {\left ({\left (b^{3} c - 4 \, a b c^{2}\right )} d - {\left (b^{4} - 5 \, a b^{2} c + 4 \, a^{2} c^{2}\right )} e\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{3} - 4 \, a c^{4}\right )}}, \frac {{\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e h x^{2} - 2 \, \sqrt {-b^{2} + 4 \, a c} {\left ({\left (2 \, c^{3} d - b c^{2} e\right )} f - {\left (b c^{2} d - {\left (b^{2} c - 2 \, a c^{2}\right )} e\right )} g + {\left ({\left (b^{2} c - 2 \, a c^{2}\right )} d - {\left (b^{3} - 3 \, a b c\right )} e\right )} h\right )} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) + 2 \, {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e g + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} h\right )} x + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} e f + {\left ({\left (b^{2} c^{2} - 4 \, a c^{3}\right )} d - {\left (b^{3} c - 4 \, a b c^{2}\right )} e\right )} g - {\left ({\left (b^{3} c - 4 \, a b c^{2}\right )} d - {\left (b^{4} - 5 \, a b^{2} c + 4 \, a^{2} c^{2}\right )} e\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{3} - 4 \, a c^{4}\right )}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.19, size = 201, normalized size = 1.14 \[ \frac {c h x^{2} e + 2 \, c d h x + 2 \, c g x e - 2 \, b h x e}{2 \, c^{2}} + \frac {{\left (c^{2} d g - b c d h + c^{2} f e - b c g e + b^{2} h e - a c h e\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{3}} + \frac {{\left (2 \, c^{3} d f - b c^{2} d g + b^{2} c d h - 2 \, a c^{2} d h - b c^{2} f e + b^{2} c g e - 2 \, a c^{2} g e - b^{3} h e + 3 \, a b c h e\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.01, size = 510, normalized size = 2.88 \[ \frac {3 a b e h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}-\frac {2 a d h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {2 a e g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {b^{3} e h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{3}}+\frac {b^{2} d h \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}+\frac {b^{2} e g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c^{2}}-\frac {b d g \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}-\frac {b e f \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}\, c}+\frac {e h \,x^{2}}{2 c}+\frac {2 d f \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}-\frac {a e h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}+\frac {b^{2} e h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{3}}-\frac {b d h \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}-\frac {b e g \ln \left (c \,x^{2}+b x +a \right )}{2 c^{2}}-\frac {b e h x}{c^{2}}+\frac {d g \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {d h x}{c}+\frac {e f \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {e g x}{c} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.53, size = 273, normalized size = 1.54 \[ x\,\left (\frac {d\,h+e\,g}{c}-\frac {b\,e\,h}{c^2}\right )-\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (b^4\,e\,h-4\,a\,c^3\,d\,g-4\,a\,c^3\,e\,f-b^3\,c\,d\,h-b^3\,c\,e\,g+b^2\,c^2\,d\,g+b^2\,c^2\,e\,f+4\,a^2\,c^2\,e\,h+4\,a\,b\,c^2\,d\,h+4\,a\,b\,c^2\,e\,g-5\,a\,b^2\,c\,e\,h\right )}{2\,\left (4\,a\,c^4-b^2\,c^3\right )}-\frac {\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )\,\left (b^3\,e\,h-2\,c^3\,d\,f+2\,a\,c^2\,d\,h+2\,a\,c^2\,e\,g+b\,c^2\,d\,g+b\,c^2\,e\,f-b^2\,c\,d\,h-b^2\,c\,e\,g-3\,a\,b\,c\,e\,h\right )}{c^3\,\sqrt {4\,a\,c-b^2}}+\frac {e\,h\,x^2}{2\,c} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [B] time = 14.46, size = 1265, normalized size = 7.15 \[ x \left (- \frac {b e h}{c^{2}} + \frac {d h}{c} + \frac {e g}{c}\right ) + \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) \log {\left (x + \frac {2 a^{2} c e h - a b^{2} e h + a b c d h + a b c e g + 4 a c^{3} \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) - 2 a c^{2} d g - 2 a c^{2} e f - b^{2} c^{2} \left (- \frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) + b c^{2} d f}{3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f} \right )} + \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) \log {\left (x + \frac {2 a^{2} c e h - a b^{2} e h + a b c d h + a b c e g + 4 a c^{3} \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) - 2 a c^{2} d g - 2 a c^{2} e f - b^{2} c^{2} \left (\frac {\sqrt {- 4 a c + b^{2}} \left (3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f\right )}{2 c^{3} \left (4 a c - b^{2}\right )} - \frac {a c e h - b^{2} e h + b c d h + b c e g - c^{2} d g - c^{2} e f}{2 c^{3}}\right ) + b c^{2} d f}{3 a b c e h - 2 a c^{2} d h - 2 a c^{2} e g - b^{3} e h + b^{2} c d h + b^{2} c e g - b c^{2} d g - b c^{2} e f + 2 c^{3} d f} \right )} + \frac {e h x^{2}}{2 c} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________